package com.caochenlei.flyweight;

public class Client {
    public static void main(String[] args) {
        ChessPiecesFactory chessPiecesFactory = new ChessPiecesFactory();

        ChessPieces cp1 = chessPiecesFactory.getChessPieces("白");
        ChessPieces cp2 = chessPiecesFactory.getChessPieces("白");
        ChessPieces cp3 = chessPiecesFactory.getChessPieces("黑");
        ChessPieces cp4 = chessPiecesFactory.getChessPieces("黑");

        Point p1 = new Point(1, 1);
        Point p2 = new Point(2, 2);
        Point p3 = new Point(3, 3);
        Point p4 = new Point(4, 4);

        cp1.downPieces(p1);
        cp2.downPieces(p2);
        cp3.downPieces(p3);
        cp4.downPieces(p4);

        System.out.println("====================");

        System.out.println(cp1 == cp2);
        System.out.println(cp3 == cp4);
    }
}
